<template>
	<view class="content">
		<view class="wid100" :style="'background-image: url('+url+'/addon/qianyu_petrol/wxapp/image/beijing-2.png);'"
			style="height: 574rpx;box-sizing: border-box;background-size: 100% 100%;">
			<view style="height: 76rpx;"></view>
			<view class="foSi25 coFFF fowe600" style="margin-left: 108rpx;">永久有效</view>
			<view class="textCen fowe600 foSi35" style="color: #6D3100;">{{userInfo.level_name}}</view>
			<view class="wid80 mar textCen fowe600 foSi40 mar-top20" style="color: #6D3100;">{{userInfo.card}}</view>
		</view>
		<view class="bacFFF wid100" style="border-top-left-radius: 40rpx;border-top-right-radius: 40rpx;margin-top: -200rpx;">
			<view class="wid90 mar">
				<view style="height: 30rpx;"></view>
				<view class="foSi40 fowe600 ">成长明细</view>
				<view class="mar-top40 dis disAl disJuB foSi22 fowe600" style="color: #6D3100;">
					<view class="textCen">
						<view>{{userInfo.level_name}}</view>
						<view>{{userInfo.development}}</view>
					</view>
					<view class="textCen">
						<view>{{userInfo.next_level_name}}</view>
						<view>{{userInfo.developmentend}}</view>
					</view>
				</view>
				<view class="wid90 mar mar-top10" style="height: 6rpx;background-color: #FF7300;">
					<view class="hei100" :style="'width: '+jindu+'%;'" style="width: 1%;background-color: #000;"></view>
				</view>
				<view class="mar-top30 dis disAl disJuC">
					<image src="../../static/shengji.png" style="width: 34rpx;height: 38rpx;"></image>
					<view class="mar-left20 foSi28 fowe600" style="color: #6D3100;vertical-align: bottom;">再获得{{userInfo.developmentend - userInfo.development}}成长值升级为{{userInfo.next_level_name}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				userInfo: '',
				jindu: 1,
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			getList() {
				var that = this;
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_user_info',
					method: "POST",
					header: {
						'site-id': that.global.site_id//自定义请求头信息
					},
					data: {
						'openid': uni.getStorageSync('openid')
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							that.userInfo = result.data
							var end = result.data.developmentend - result.data.developmentstart
							var dang = result.data.development - result.data.developmentstart
							that.jindu = ((1-(end - dang) / end) * 100) >= 1?(1-(end - dang) / end) * 100:1 
						}
					}
				})
			},
		}
	}
</script>

<style>
	.content {}

</style>
